﻿using System.Collections.Generic;
using System.Linq;

namespace winS.Unity.Process
{
    public class RouletteRandomStep : Step
    {
        public List<Bet> betList = new List<Bet>();

        private readonly Roulette<List<string>> roulette = new Roulette<List<string>>();

        public override IEnumerable<string> GetSubsequentSteps(ProcessContext processContext)
        {
            roulette.Clear();
            foreach (var bet in betList) roulette.AddBet(bet.nextList, bet.weight);
            return roulette.Get();
        }

        public class Bet
        {
            public float weight;
            public List<string> nextList = new List<string>();

            public void AddStep(IStep step)
            {
                nextList.Add(step.guid);
            }

            public void Remove(IStep step)
            {
                nextList.Remove(step.guid);
            }
        }
    }
}